package com.luck.pf.framework.advice;

import java.lang.reflect.Method;

import org.springframework.aop.AfterReturningAdvice;

import com.luck.org.entity.SysLog;
import com.luck.pf.common.logic.ICommonLogic;

public class LogAdvice implements AfterReturningAdvice {
	private ICommonLogic commonLogic;

	public void afterReturning(Object returnValue, Method method, Object[] args,
			Object target) throws Throwable {
		if (null!=args){
		 for(Object obj:args){
			 //记录日志
			 if (obj instanceof SysLog&&null!=obj){
				 commonLogic.save(obj);
				 return ;
			 }
		 }
		}
 	}

	public ICommonLogic getCommonLogic() {
		return commonLogic;
	}

	public void setCommonLogic(ICommonLogic commonLogic) {
		this.commonLogic = commonLogic;
	}
}
